package com.breezelin.freshmarket.entities.req;

/**
 * Created by Breeze Lin
 * 2:46 2016/5/19
 * 1linyufeng1@gmail.com
 */

import com.breezelin.freshmarket.entities.JsonStruct;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * 产品详情请求体
 */
public class ProductReq implements JsonStruct {

	/*
	{
        "NetworkType": "wifi",
        "CommodityId": "69664ad1-6563-462b-b688-1058abdcce55"
    }
	 */

	/**
	 * 产品id
	 */
	private String commodityId;
	/**
	 * 网络情况
	 */
	private String networkType;

	public ProductReq(String commodityId) {
		this.commodityId = commodityId;
		// 默认wifi
		networkType = "wifi";
	}

	@Override
	public void fromJson(JSONObject jsonObject) {

	}

	@Override
	public JSONObject toJson() {
		JSONObject jsonObject = new JSONObject();
		try {
			jsonObject.put("CommodityId", commodityId);
			jsonObject.put("NetworkType", networkType);
		} catch (JSONException e) {
			e.printStackTrace();
		}
		return jsonObject;
	}
}
